<template>
    <div>
        <h2>我是app</h2>
        <button @click="sendAxios">测试axios</button>
        <button @click="sendAxiosPost">测试axios</button>
    </div>
</template>

<script>
import axios from 'axios';
export default {
    methods: {
        sendAxios() {
            axios
                .get('http://127.0.0.1:3000/students/check', {
                    params: {
                        pageNum: 1,
                        pageSize: 10
                    }
                })
                .then((res) => {
                    console.log(res);
                })
                .catch((e) => {
                    console.log(e);
                });
        },
        sendAxiosPost() {
            axios
                .post('http://127.0.0.1:3000/students/add', {
                    name: 'Fred',
                    phone: 'Flintstone',
                    address: 'dsadas',
                    age: '18'
                })
                .then(function (response) {
                    console.log(response);
                })
                .catch(function (error) {
                    console.log(error);
                });
        }
    }
};
</script>

<style></style>
